package com.brodong.animal_remake.common.skills;

import com.brodong.animal_remake.common.entities.monster.realization.SkillBasicEntity;
import net.minecraft.world.entity.ai.goal.Goal;

import java.util.EnumSet;
//施法目标
public class ReleaseskillGoal extends Goal {
    protected SkillBasicEntity mob;
    public ReleaseskillGoal(SkillBasicEntity mo) {
        mob=mo;
        this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK));
    }
    public boolean canUse() {
        return mob.getSpellCastingTime() > 0;
    }
    public void start() {
        super.start();
        mob.getNavigation().stop();
    }
    public void stop() {
        super.stop();
        mob.setIsCastingSpell(Currentskills.NONE);
    }
    public void tick() {
        if (mob.getTarget() != null) {
            mob.getLookControl().setLookAt(mob.getTarget(), (float)mob.getMaxHeadYRot(), (float)mob.getMaxHeadXRot());
        }
    }
}